CXX:=gcc
CXXFLAGS:=-I ./inc -nostdlib -ffreestanding -Wall
LD:=ld
LDFLAGS:=-T linker.ld
AS:=as
SRCS_AS:=$(shell find -mindepth 1 -maxdepth 3 -name "*.s")
SRCS_CXX:=$(shell find -mindepth 1 -maxdepth 3 -name "*.c")
OBJS:=$(patsubst %.s,%.o,$(SRCS_AS)) $(patsubst %.c,%.o,$(SRCS_CXX))
OUTPUT:=kernel

default: $(OUTPUT)
$(OUTPUT) : $(OBJS)
	$(LD) $(LDFLAGS) -o $(OUTPUT) $(OBJS)
%.o : %.c
	$(CXX) $(CXXFLAGS) -c $<
%.o : %.s
	$(AS) $< -o $@
install: 
	cp kernel $(TARGET)/kernel/kernel